<template>
    <div id='teml'>
        <!--所有的html样式-->
        <mt-header fixed title="杭州新奥科技" class='hz_color'></mt-header>
		<div id="back" v-if="isshow">
			<a href="javascript:void(0)" @click="backto" >返 回</a>
		</div>
        <router-view></router-view>
		
        <nav class="mui-bar mui-bar-tab">
			<router-link class="mui-tab-item " to="/home">
				<span class="mui-icon mui-icon-home"></span>
				<span class="mui-tab-label">首页</span>
			</router-link>
			<router-link class="mui-tab-item" to="/userinfo">
				<span class="mui-icon mui-icon-email">				
				</span>
				<span class="mui-tab-label">会员</span>
			</router-link>
			<router-link class="mui-tab-item" to="/shopcar">
				<span class="mui-icon mui-icon-eye">
					<span class="mui-badge" id="shopcou">0</span>
				</span>
				<span class="mui-tab-label">购物车</span>
			</router-link>
			<router-link class="mui-tab-item" to="/tabbar-with-map">
				<span class="mui-icon mui-icon-search"></span>
				<span class="mui-tab-label">搜索</span>
			</router-link>
		</nav>
    </div>
</template>

<script>
	import {vm,COUNTSTR} from './kikt/vm.js'
	vm.$on(COUNTSTR,function(count){
		var shopcou = document.getElementById('shopcou');
		shopcou.innerText = parseInt(shopcou.innerText) + count;
	})
	export default{
		data(){
			return {
				isshow:false
			}
		},
		watch:{
			'$route':function(newroute,oldroute){
				if(newroute.path.toLowerCase() == '/home'
				|| newroute.path.toLowerCase() == '/userinfo'
				|| newroute.path.toLowerCase() == '/login'){
					this.isshow = false;
				}else{
					this.isshow = true;
				}
			}
		},
		methods:{
			backto(){
				this.$router.go(-1);
			}
		}
	}
</script>

<style scoped>
	#back {
		width: 60px;
		height: 40px;
		z-index: 1000;
		position: fixed;
		top: 0px;
		left: 5px;
		line-height: 40px;
		text-align: center;
	
	}
	#back a {
		color: white;
		font-size: 16px;
		font-weight: 700;
		display: inline-block;
		background: #0DB2A0;
		border-radius: 20px;
		width: 60px;
		height: 40px;
	}
</style>